package day8;

import org.junit.Test;

public class ExceptionDemo {

    public void quQian(double money) throws MeiQianException {
        if (money >= 1000) {
            throw new MeiQianException("钱不够");
        }
        System.out.println("钱够了");
    }


    public class MeiQianException extends Exception{

        //message代表抛出这个异常要打印的错误信息
        public MeiQianException(String message) {
            super(message);
        }
    }

    @Test
    public void test22() {
        try {
            quQian(122);
        } catch (MeiQianException e) {
            e.printStackTrace();
        }
    }


}
